import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Category } from './category.entity';

@Entity()
export class Interview {
  // 主键
  @PrimaryGeneratedColumn()
  id: number;

  // 标题
  @Column()
  title: string;

  // 内容
  @Column({ type: 'text' })
  content: string;

  // 来源
  @Column({ default: '' })
  from: string;

  // 作者
  @Column({ default: '' })
  author: string;

  // 喜欢、有用、收藏
  @Column({ default: false })
  like: boolean;

  @Column()
  uid: string;

  @ManyToOne(() => Category, (category) => category.name)
  category: Category;
}
